﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Templates/Acuicultura.Master" AutoEventWireup="true"
    CodeBehind="frmFactores.aspx.cs" Inherits="EstadisticaProduce.Acuicultura.frmFactores" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:HiddenField ID="hdnaccion" runat="server" />
    <asp:HiddenField ID="hdnperiodo" runat="server" />
    <asp:HiddenField ID="hdncodempresa" runat="server" />
    <asp:HiddenField ID="hdncodestablecimiento" runat="server" />
    <asp:HiddenField ID="hdncodregistro" runat="server" />
    <table class="clsTablaForm">
    <tr>
                        <td colspan="2">
                            <h2 class="abajo15 border-bottom">
                                Factores que afectaron la cosecha del mes en comparaci&oacute;n con el mes anterior</h2>
                        </td>
                    </tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="lblTitulo" runat="server" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="lblTotalPeriodoActual" runat="server" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="lblTotalPeriodoAnterior" runat="server" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:GridView runat="server" ID="gvResultado" AutoGenerateColumns="false"
                    DataKeyNames="codfactor,desfactor,contador, desotros" EmptyDataText="No se han generado Patrones para este Archivo"
                    EmptyDataRowStyle-CssClass="clsNoDatos" EditRowStyle-HorizontalAlign="Center"
                    OnRowDataBound="gvResultado_RowDataBound" Width="100%" CssClass="clsTabla">
                    <Columns>
                        <asp:TemplateField HeaderText="Select">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkSelect" onclick="javascript:Check_Click(this);" runat="server" />
                            </ItemTemplate>
                            <HeaderTemplate>
                            </HeaderTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="10" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="desfactor" HeaderText="Factor">
                            <ItemStyle CssClass="hiddencols" Width="300px" HorizontalAlign="left" />
                            <HeaderStyle CssClass="hiddencols" />
                        </asp:BoundField>
                        <asp:BoundField DataField="contador" HeaderText="cany">
                            <ItemStyle CssClass="hiddencol" />
                            <HeaderStyle CssClass="hiddencol" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Observaciones">
                            <ItemTemplate>
                                <asp:TextBox ID="txtDetalle" runat="server" Text='<%# Bind("desotros") %>' Width="100%"
                                    MaxLength="200" />
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="left" />
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle CssClass="HeaderStyle" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Left" Font-Bold="False" />
                    <RowStyle CssClass="RowStyle" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td colspan="5">
                <div class="contentButton">
                    <asp:Button ID="btnGraba" CssClass="boton button-small" runat="server" Text="Guardar"
                        OnClick="btnGraba_Click" />
                    <asp:Button ID="btnLimpia" CssClass="button-small p3" runat="server" Text="Limpiar"
                        OnClick="btnLimpia_Click" />
                </div>
            </td>
        </tr>
    </table>
    <script type="text/javascript">

        function Check_Click(objRef) {
            //Get the Row based on checkbox
            var row = objRef.parentNode.parentNode;
            if (objRef.checked) {
                row.style.backgroundColor = "#C2D69B";
            }
            else {
                row.style.backgroundColor = "#F7F6F3";
            }

            //Get the reference of GridView
            var GridView = row.parentNode;
            //Get all input elements in Gridview
            var inputList = GridView.getElementsByTagName("input");

            for (var i = 0; i < inputList.length; i++) {
                //The First element is the Header Checkbox
                var headerCheckBox = inputList[0];
                //Based on all or none checkboxes are checked check/uncheck Header Checkbox
                var checked = true;
                if (inputList[i].type == "checkbox" && inputList[i] != headerCheckBox) {

                    if (!inputList[i].checked) {
                        checked = false;
                        break;
                    }
                }
            }
        }

    </script>
    <script type="text/javascript">
        $(function () {
            InitializeDeleteConfirmation();

        });

        function InitializeDeleteConfirmation() {
            $('#deleteConfirmationDialog').dialog({
                autoOpen: false,
                resizable: false,
                height: 120,
                modal: true,
                buttons: {
                    "Delete": function () {
                        $(this).dialog("close");
                        $(this).css("font-size:10px")
                    },
                    Cancel: function () {
                        $(this).dialog("close");
                    }
                }
            });
        }

        function deleteItem(uniqueID, itemID) {
            var dialogTitle = 'Eliminar registro ' + itemID + '?';

            $("#deleteConfirmationDialog").html('<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Por favor confirme la eliminación del Registro</p>');

            $("#deleteConfirmationDialog").dialog({
                title: dialogTitle,
                buttons: {
                    "Eliminar": function () { __doPostBack(uniqueID, ''); $(this).dialog("close"); },
                    "Cancelar": function () { $(this).dialog("close"); }
                }
            });

            $('#deleteConfirmationDialog').dialog('open');
            return false;
        }

        function ShowError(errorMessage) {
            $(document).ready(function () {
                $("#deleteErrorDialog").text(errorMessage);
                $("#deleteErrorDialog").dialog({
                    modal: true,
                    buttons: {
                        Ok: function () {
                            $(this).dialog("close");
                            $(this).css("font-size", 11);
                        }
                    }
                });
            });
        }
    </script>
    <div id="deleteConfirmationDialog" style="font-size: 10px;">
    </div>
    <div id="deleteErrorDialog" title="Aviso:" style="font-size: 10px;">
    </div>
</asp:Content>
